//-----------------------------------------------------------------------
// <copyright file="PictureServiceBase.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using Pyco;
using Pyco.Diagnostics;
using Pyco.Data;
using .Entities;
using .Data;
    
namespace .Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class PictureServiceBase
    {
        #region PictureServiceBase

        public static void CreatePicture(Picture picture)
        {            
            try
            {
                PictureDAO pictureDAO = new PictureDAO();
                pictureDAO.CreatePicture(picture);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessCreatePictureException, ex);
            }
        }

        public static void UpdatePicture(Picture picture)
        {            
            try
            {
                PictureDAO pictureDAO = new PictureDAO();
                pictureDAO.UpdatePicture(picture);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessUpdatePictureException, ex);
            }
        }        

        public static void DeletePicture(long pictureId)
        {            
            try
            {
                PictureDAO pictureDAO = new PictureDAO();
                pictureDAO.DeletePicture(pictureId);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessDeletePictureException, ex);
            }
        }
		
        public static Picture GetPicture(long pictureId)
        {            
            try
            {
                PictureDAO pictureDAO = new PictureDAO();
                return pictureDAO.GetPicture(pictureId);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetPictureException, ex);
            }
        }                
		
        public static PictureCollection GetPictureList(PictureColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                PictureDAO pictureDAO = new PictureDAO();
                return pictureDAO.GetPictureList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetPictureListException, ex);
            }
        }        

        public static PictureCollection GetPictureList(PictureColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                PictureDAO pictureDAO = new PictureDAO();
                return pictureDAO.GetPictureList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetPictureListException, ex);
            }
        }        
		
		
        #endregion
    }
}